#pragma once
#include "innermtypes.h"
#include "MValue.h"
#include <vector>
BEGIN_MARIONETTE
namespace ASM{
	class ArgumentOperator{
	public:
		virtual void* GanerateCode(void* pCode,DWORD value) = 0;
	};
	class PUSH:public ArgumentOperator{
		void* GanerateCode(void* pCode,DWORD value);
	};

	ArgumentOperator* NEW_PUSH();
}

class MFunction_Type :
	public MDWORD
{
public:
	MString Name(){return "Function";}
	MFunction_Type(void);
	~MFunction_Type(void);

	void ResetArgumentDefine();

	MValue Call(MValue* v,MArguments* pArgs);

PBYTE GenFlatStack( PBYTE pCode );

PBYTE GenTranslateArgument( PBYTE pCode, MArguments* pArgs );

	void DefineArgument(int index,ASM::ArgumentOperator* asmOperator);
private:
	std::vector<ASM::ArgumentOperator*> m_ArgumentOpoerators;
	char m_Code[1000];
	int m_LastArgumentIndex;
};

END_MARIONETTE